/**
 * Creat by TanLei
 * Description:
 * User:86183
 * Date:2022-05-11
 * Time:9:36
 */
public class Demo6 extends Thread{
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true){
                try {
                    Thread.sleep(1000);
                    System.out.println("hello thread");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        thread.start();

        while (true){
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
